﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="settle_application.aspx.cs" Inherits="Customer_Profile.eCard.Settle.settle_application" %>
<%@ Register assembly="DevExpress.Web.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDataView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register src="../../mainTop.ascx" tagname="mainTop" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Customer List</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
    <meta content="C#" name="CODE_LANGUAGE" />
    <meta content="JavaScript" name="vs_defaultClientScript" />
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/css/style.css" type="text/css" rel="stylesheet" />

    <script language="javascript" type="text/javascript" src="/js/common.js"></script>

    <script language="javascript" type="text/javascript" src="/js/CalPopUp.js"></script>
    <script language="javascript">
        function checkform() {
            var fee_percent = document.getElementById("txtCommssion").value;
            var accountname = document.getElementById("accountname").value;
            var accountno = document.getElementById("accountno").value;
            var bankname = document.getElementById("bankname").value;
            var branch = document.getElementById("branch").value;
            var subbranch = document.getElementById("subbranch").value;
            var location = document.getElementById("location").value;
            var city = document.getElementById("city").value;

            if (fee_percent == '') {
                alert('结算手续费比率不能空！');
                return false;
            }

            if(accountname=='')
            {
                alert('账户名不能为空');
                return false;
            }

            if(accountno=='')
            {
                alert('账号不能为空');
                return false;
            }

            if(bankname=='')
            {
                alert('银行名称不能为空');
                return false;
            }

            if(branch=='')
            {
                alert('银行分行名称不能为空');
                return false;
            }

            if(subbranch=='')
            {
                alert('银行支行名称不能为空');
                return false;
            }

            if(location=='')
            {
                alert('省份不能为空');
                return false;
            }

            if(city=='')
            {
                alert('城市不能为空');
                return false;
            }
            return true;
        }

        function filecheckok() {
            var filepath = document.getElementById("FileUpload1");
            if (filepath.value == 'null' || filepath.value == '') {
                alert("请先选择要上传的文件");
                return false;
            }
            return true;
        }

        function checkDelete() {
            return confirm("你确认要取消结算申请吗？取消后数据将无法找回！");
        }

        function checkSubmit() {
            return confirm("你确认要提交到总部吗？");
        }

        function calcAmount() {
            var SettleAmount = document.getElementById("txtSettleAmount").value;
            var Commssion = document.getElementById("txtCommssion").value;
            
            var txtSettleFee = document.getElementById("txtSettleFee");
            var txtPayAmount = document.getElementById("txtPayAmount");

            txtSettleFee.value = formatFloat(SettleAmount * Commssion,2);
            txtPayAmount.value = formatFloat(SettleAmount - (SettleAmount * Commssion), 2);

            var hidPayAmount = document.getElementById("hidPayAmount");
            hidPayAmount.value = txtPayAmount.value
        }

        function calcAmount1() {
            var SettleAmount = document.getElementById("txtSettleAmount").value;
            var SettleFee = document.getElementById("txtSettleFee").value;

            var txtCommssion = document.getElementById("txtCommssion");
            var txtPayAmount = document.getElementById("txtPayAmount");

            txtCommssion.value = formatFloat(SettleFee / SettleAmount, 4);
            txtPayAmount.value = formatFloat(SettleAmount - SettleFee, 2);
            
            var hidPayAmount = document.getElementById("hidPayAmount");
            hidPayAmount.value = txtPayAmount.value
        }

        function keydown() {
            if (event.keyCode == 13)
                event.keyCode = 9
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <uc1:mainTop ID="mainTop1" runat="server" />
        <table border="1">
            <tr>
                <td align="right">卡号：</td>
                <td align="left">
                    <asp:TextBox ID="txtcardno" runat="server" class="input2" ReadOnly="true"></asp:TextBox>
                    <asp:Label ID="lblCpartyName" runat="server"></asp:Label>
                    <asp:HiddenField ID="hidCpartyID" runat="server" />
                    <asp:HiddenField ID="hidSettle_id" runat="server" />
                    <asp:HiddenField ID="hidDeal_no" runat="server" />
                    <asp:Label ID="lblCommsionWarning" runat="server" 
                        ForeColor="#FF3300"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right">结算金额：</td>
                <td align="left"><asp:TextBox ID="txtSettleAmount" class="input2" onkeydown="keydown();" onchange="calcAmount()" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">结算手续比率：</td>
                <td align="left"><asp:TextBox ID="txtCommssion" class="input2" onkeydown="keydown();" onchange="calcAmount()" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">结算手续费：</td>
                <td align="left"><asp:TextBox ID="txtSettleFee" class="input2" onkeydown="keydown();" onchange="calcAmount1()" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">支付金额：</td>
                <td align="left"><asp:TextBox ID="txtPayAmount" class="input2" runat="server"></asp:TextBox></td>
                <asp:HiddenField ID="hidPayAmount" runat="server" />
            </tr>
            <tr>
                <td align="right">回购公司：</td>
                <td align="left">
                    <asp:DropDownList ID="DropSettleAgent" runat="server"></asp:DropDownList>
                </td>                
            </tr>
            <tr>
                <td align="right">结算账户：</td>
                <td align="left">
                <table bordercolor="#c2d2e2" cellspacing="0" cellpadding="2" width="100%" border="1">
                        <tr>
                            <td>
                                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                    <tr>
                                        <td bgcolor="#1765a7">
                                            <img height="11" src="/images/pic_results.gif" width="61"></td>
                                    </tr>
                                </table>                               
                                常用汇款账户：<asp:DropDownList 
                                    ID="DropBackAccount" runat="server" AutoPostBack="True" 
                                    onselectedindexchanged="DropBackAccount_SelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tr>
                            <td>
                                <img height="3" src="/images/spacer.gif" width="1"></td>
                        </tr>
                    </table>
                    <table cellspacing="0" cellpadding="0" width="100%" border="1">
                        <tr>
                            <td>账户名称：<font color="red">*</font></td>
                            <td>                              
                                <asp:TextBox ID="accountname" class="input2" runat="server"></asp:TextBox>
                            </td>
                            <td>账户号：<font color="red">*</font></td>
                            <td>                               
                                 <asp:TextBox ID="accountno" class="input2" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                银行名称：<font color="red">*</font>
                            </td>
                            <td>                              
                                 <asp:TextBox ID="bankname" class="input2" runat="server"></asp:TextBox>
                            </td>
                            <td>
                               分行/支行:<font color="red">*</font>
                            </td>
                            <td>
                            <table>
                                <tr>
                                    <td>                                        
                                        <asp:TextBox ID="branch" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                    <td>/</td>
                                    <td>                                       
                                        <asp:TextBox ID="subbranch" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                            </td>
                        </tr>
                        <tr>
                            <td>省份：<font color="red">*</font></td>
                            <td>                                
                                <asp:TextBox ID="location" class="input2" runat="server"></asp:TextBox>
                            </td>
                            <td>城市：<font color="red">*</font></td>
                            <td>                                
                                <asp:TextBox ID="city" class="input2" runat="server"></asp:TextBox>
                            </td>
                        </tr>                       
                        <tr>
                            <td colspan=4>
                                <asp:Button ID="Button1" runat="server" Text="保存到常用汇款账户"  OnClientClick="return checkform();" onclick="btnSave_Click" />&nbsp;                                
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="right">附件：</td>
                <td align="left">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>                                                   
                            <td  width="70%">
                                <dx:ASPxGridView ID="gridAttach" runat="server" Width="100%" 
                                    CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                                    CssPostfix="Office2003Blue" 
                                    oncustombuttoncallback="gridAttach_CustomButtonCallback">
                                    <Images SpriteCssFilePath="~/App_Themes/Office2003Blue/{0}/sprite.css">
                                        <LoadingPanelOnStatusBar Url="~/App_Themes/Office2003Blue/GridView/gvLoadingOnStatusBar.gif">
                                        </LoadingPanelOnStatusBar>
                                        <LoadingPanel Url="~/App_Themes/Office2003Blue/GridView/Loading.gif">
                                        </LoadingPanel>
                                    </Images>
                                    <ImagesFilterControl>
                                        <LoadingPanel Url="~/App_Themes/Office2003Blue/Editors/Loading.gif">
                                        </LoadingPanel>
                                    </ImagesFilterControl>
                                    <Styles CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" CssPostfix="Office2003Blue">
                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                        </Header>
                                        <LoadingPanel ImageSpacing="10px">
                                        </LoadingPanel>
                                    </Styles>
                                    <StylesEditors>
                                        <ProgressBar Height="25px">
                                        </ProgressBar>
                                    </StylesEditors> 
                                    <Columns>
                                        <dx:GridViewDataColumn FieldName="attach_id" VisibleIndex="1" Caption="ID" />
                                        <dx:GridViewDataColumn FieldName="deal_no" VisibleIndex="2" Caption="交易号" />
                                        <dx:GridViewDataColumn Caption="显示名称" VisibleIndex="3">
                                            <DataItemTemplate>
                                                <a href='<%#Eval("attach_url") %>' target="_blank" ><%#Eval("view_name")%></a>
                                            </DataItemTemplate>
                                        </dx:GridViewDataColumn>
                                        <dx:GridViewDataColumn FieldName="attach_name" VisibleIndex="4" Caption="附件名称" />
                                        <dx:GridViewDataColumn FieldName="attach_type" VisibleIndex="5" Caption="附件类别" />
                                        <dx:GridViewDataColumn FieldName="attach_size" VisibleIndex="6" Caption="大小" />
                                        <dx:GridViewCommandColumn VisibleIndex="7" Caption="删除">
                                            <CustomButtons>
                                                <dx:GridViewCommandColumnCustomButton Text="删除" ID="Delete" />
                                            </CustomButtons>
                                        </dx:GridViewCommandColumn>
                                   </Columns>                                                        
                                </dx:ASPxGridView>                                                        
                            </td>
                            <td width="30%">
                                选择文件：<asp:FileUpload ID="FileUpload1" runat="server"  />
                                <asp:Button ID="btnUpload" Text="上传" runat="server" OnClientClick="return filecheckok();" onclick="btnUpload_Click" />                                                       
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="right">备注：</td>
                <td align="left">
                    <asp:TextBox ID="txtRemark" class="input2" width="98%" runat="server" ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right">审核备注：</td>
                <td align="left">
                   <asp:Label ID="lblBackReason" runat="server" forecolor="red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right">提示：</td>
                <td align="left"><asp:Label ID="lblWarning" runat="server" forecolor="red"></asp:Label></td>
            </tr>
            <tr>
                <td align="center">
                <asp:Button ID="btnSave" runat="server" Text="保存" OnClientClick="return checkform();"  onclick="btnSave_Click1"  />                
                </td>
                <td align="center">                
                    <asp:Button ID="btnSubmit" runat="server" Text="提交到总部" OnClientClick="return checkSubmit();"  onclick="btnSubmit_Click"  />
                    <asp:Button ID="btnCancel" runat="server" Text="取消结算申请"  OnClientClick="return checkDelete();" onclick="btnCancel_Click" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>